define(function(require, exports, module) {
    'use strict';

    var $ = require('jquery');
    var Slider = require('plugins/slider');
    var LazyStream = require('plugins/lazystream');
    require('plugins/imgLoading');

    $('.jImg').imgLoading();

    function rem(value){
        return value/46.875+'rem';
    }

    var lazyMore = new LazyStream('.jPage', {
        plUrl: '/json/index-list.php',
        paramFormater: function(n) {
            var data = {};
            data.pageNo = n;
            return data;
        },
        page:2,
        errorText: '<div class="loading">网络错误，点击重试</div>',
        loadingClass: 'loading',
        loadingText: '<div class="loading"><img src="../../image/plugins/loading.gif" class="load-gif" />正在加载，请稍后...</div>',
        load: function(el) {
            $(el).find('.jImg').imgLoading();
        },
        noAnyMore:'<div class="loading">sorry,已经没有下一页了...</div>'
    });

    $('.jSearchIpt').focus(function(){
        $('.jSub').animate({left: rem(40)});
    });

    $('.jSearchIpt').keyup(function(){
        var self = this;
        if($.trim($(self).val()) == ""){
            $('.jSub').animate({left: rem(200)});
        }
    });

    $('.jSub').click(function(){
        $('#jSearchForm').submit();
    });

    if($.trim($('.jSearchIpt').val()) !== ""){
        $('.jSub').animate({left: rem(40)});
    }

});
